<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc.">
    <meta name="author" content="Coderthemes">
	
	<!-- jQuery  -->
    <script type="text/javascript" src="/static/plugins/jquery/jquery-3.6.0.min.js"></script>
	
	<!-- layui  -->
	<link rel="stylesheet" href="/static/plugins/layui/2.7.6/css/layui.css" media="all" />
	<script src="/static/plugins/layui/2.7.6/layui.js" charset="utf-8"></script>
	
	<link rel="stylesheet" href="/static/admin/css/mini-ease-edit.css">
</head>
<body>

	<form class="layui-form" id="formId" method="post" action="/api/inter/tpAmazonShop/refreshOrderByShop">
		<div class="layui-form-item">
			<div class="layui-col-md5">
				<label class="layui-form-label">店铺名称</label>
				<div class="layui-input-block">
					<input type="text" name="nameShop" th:value="${dto.nameShop}" class="layui-input layui-disabled" readonly>
				</div>
			</div>
		</div>

		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
		<div class="layui-form-item">
			<div class="layui-col-md1 layui-col-md-offset11">
				<div class="layui-btn-container">
					<button type="button" class="layui-btn" lay-submit lay-filter="formSubmit">确定同步</button>
				</div>
			</div>
		</div>
	</form>
	<script>
	$(function () {
		layui.use(['form', 'laydate'], function(){
			var form = layui.form;
			var laydate = layui.laydate;
			
			// 表单提交，共用同一个
			form.on('submit(formSubmit)', function(data){
				var indexOfLoading = layer.load(1, {
					shade: [0.5,'#000000'] //0.1透明度的白色背景
				});
				$.post(data.form.action, data.field, function(res){
					if (res.code == 0) {
						layer.msg(res.msg);
						setTimeout(function(){
							window.location.reload();
						}, 1000);
					} else {
						layer.close(indexOfLoading);
						layer.msg(res.msg);
					}
				});
				return false;
			});
			
			//初始化搜索框-日期范围
			lay('input[name="purchaseDayRange"]').each(function(){
				var myDate = new Date();
				var maxtime = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + (myDate.getDate());
				laydate.render({
					elem: this
					, type: 'date'
					, max: maxtime
					, range: '~'
					//, max: maxtime//设置选择最大时间为当前
					, calendar: true
					, btns: ['clear', 'confirm', 'now']
					, done: function (value, date) {
						//这里时选中后触发事件
						//value是选中的值
						var time = value;
					}
				});
			});
			
			//初始化搜索框-日期范围
			lay('input[name="latestUpdateDayRange"]').each(function(){
				var myDate = new Date();
				var maxtime = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + (myDate.getDate());
				laydate.render({
					elem: this
					, type: 'date'
					, max: maxtime
					, range: '~'
					//, max: maxtime//设置选择最大时间为当前
					, calendar: true
					, btns: ['clear', 'confirm', 'now']
					, done: function (value, date) {
						//这里时选中后触发事件
						//value是选中的值
						var time = value;
					}
				});
			});
		});
	});
	</script>

</body>
</html>
